package conf;

import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * Created by lvdouStart on 2017/6/22.
 */
@Configuration
//在sqlSessionFactory创建后再执行
@AutoConfigureAfter(MybatisConfiguration.class)
public class MyBatisMapperScannerConfig {

    //配置接口扫描
    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer(){
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();

        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
        mapperScannerConfigurer.setBasePackage("dao");

        return mapperScannerConfigurer;
    }


}
